package com.example.myapplication.data

import com.example.myapplication.TestResult
import kotlinx.coroutines.delay
import org.hades.corelib.base.data.NetResult
import org.hades.corelib.base.repo.CoreRepository
import org.hades.corelib.base.repo.checkResultCode
import org.hades.corelib.base.repo.checkResultData
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
open class TestRespo @Inject constructor(): CoreRepository {

    suspend fun getTestDatas(test: String):List<TestResult>{
        val datas = mutableListOf<TestResult>()
        for (i in 1..20){
            datas.add(TestResult("我是(${i*Math.random()})"))
        }
        delay(300)
        return NetResult<List<TestResult>>(2000,"成功", datas)
            .checkResultCode()
            .checkResultData()
    }
}